#include "bashinfo.h"

BashInfo::BashInfo(QWidget *parent)
    : QWidget(parent)
{
    initUI();
    setLineEditState(false);
}

#include <QGridLayout>
void BashInfo::initUI()
{
    QGridLayout *pGridLayout = new QGridLayout();
    QLabel *plabels = new QLabel("s:", this);
    m_pLabel_S = new QLabel(this);
    pGridLayout->addWidget(plabels, 0, 0, 1, 1, Qt::AlignRight);
    pGridLayout->addWidget(m_pLabel_S, 0, 1);

    QLabel *plabelStartPoint = new QLabel("起始点:", this);
    pGridLayout->addWidget(plabelStartPoint, 1, 0, 1, 1, Qt::AlignRight);

    QLabel *plabelStartx = new QLabel("x:", this);
    m_pLineEdit_StartX = new QLineEdit(this);
    QLabel *plabelStarty = new QLabel("y:", this);
    m_pLineEdit_StartY = new QLineEdit(this);
    pGridLayout->addWidget(plabelStartx, 2, 0, 1, 1, Qt::AlignRight);
    pGridLayout->addWidget(m_pLineEdit_StartX, 2, 1, 1, 1);
    pGridLayout->addWidget(plabelStarty, 2, 2, 1, 1, Qt::AlignRight);
    pGridLayout->addWidget(m_pLineEdit_StartY, 2, 3, 1, 1);

    QLabel *plabelEndPoint = new QLabel("结束点", this);
    pGridLayout->addWidget(plabelEndPoint, 3, 0, 1, 1, Qt::AlignRight);

    QLabel *plabelEndx = new QLabel("x:", this);
    m_pLineEdit_EndX = new QLineEdit(this);
    QLabel *plabelEndy = new QLabel("y:", this);
    m_pLineEdit_EndY = new QLineEdit(this);
    pGridLayout->addWidget(plabelEndx, 4, 0, 1, 1, Qt::AlignRight);
    pGridLayout->addWidget(m_pLineEdit_EndX, 4, 1, 1, 1);
    pGridLayout->addWidget(plabelEndy, 4, 2, 1, 1, Qt::AlignRight);
    pGridLayout->addWidget(m_pLineEdit_EndY, 4, 3, 1, 1);

    setLayout(pGridLayout);
}

void BashInfo::setLineEditState(bool bState)
{
    m_pLineEdit_EndX->setEnabled(bState);
    m_pLineEdit_EndY->setEnabled(bState);
    m_pLineEdit_StartX->setEnabled(bState);
    m_pLineEdit_StartY->setEnabled(bState);
}
